forked from opensearch-project/security
-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
WIP adding security resource sharing SPI and sample-extension-plugin #26
Open
cwperks
wants to merge
86
commits into
main
Choose a base branch
from
resource-sharing
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+4,174
−55
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Signed-off-by: Craig Perkins <[email protected]>
Signed-off-by: Craig Perkins <[email protected]>
Signed-off-by: Craig Perkins <[email protected]>
Signed-off-by: Craig Perkins <[email protected]>
Signed-off-by: Craig Perkins <[email protected]>
Signed-off-by: Craig Perkins <[email protected]>
5 tasks
Signed-off-by: Craig Perkins <[email protected]>
Signed-off-by: Craig Perkins <[email protected]>
Signed-off-by: Craig Perkins <[email protected]>
Signed-off-by: Craig Perkins <[email protected]>
Signed-off-by: Craig Perkins <[email protected]>
Signed-off-by: Craig Perkins <[email protected]>
Signed-off-by: Craig Perkins <[email protected]>
Signed-off-by: Craig Perkins <[email protected]>
Signed-off-by: Craig Perkins <[email protected]>
Signed-off-by: Craig Perkins <[email protected]>
Signed-off-by: Craig Perkins <[email protected]>
Signed-off-by: Craig Perkins <[email protected]>
Signed-off-by: Craig Perkins <[email protected]>
Signed-off-by: Craig Perkins <[email protected]>
Signed-off-by: Craig Perkins <[email protected]>
Signed-off-by: Craig Perkins <[email protected]>
Signed-off-by: Craig Perkins <[email protected]>
Signed-off-by: Craig Perkins <[email protected]>
Signed-off-by: Craig Perkins <[email protected]>
Signed-off-by: Craig Perkins <[email protected]>
Signed-off-by: Craig Perkins <[email protected]>
Signed-off-by: Craig Perkins <[email protected]>
…rce service Signed-off-by: Craig Perkins <[email protected]>
Signed-off-by: Craig Perkins <[email protected]>
Signed-off-by: Craig Perkins <[email protected]>
Signed-off-by: Craig Perkins <[email protected]>
…ble GetResourceTransportAction Signed-off-by: Craig Perkins <[email protected]>
Signed-off-by: Craig Perkins <[email protected]>
Signed-off-by: Craig Perkins <[email protected]>
Signed-off-by: Craig Perkins <[email protected]>
Signed-off-by: Craig Perkins <[email protected]>
Signed-off-by: Craig Perkins <[email protected]>
Signed-off-by: Craig Perkins <[email protected]>
Signed-off-by: Craig Perkins <[email protected]>
Signed-off-by: Craig Perkins <[email protected]>
Signed-off-by: Craig Perkins <[email protected]>
Signed-off-by: Craig Perkins <[email protected]>
Signed-off-by: Craig Perkins <[email protected]>
Signed-off-by: Craig Perkins <[email protected]>
Open
3 tasks
Signed-off-by: Craig Perkins <[email protected]>
3 tasks
Signed-off-by: Craig Perkins <[email protected]>
Signed-off-by: Craig Perkins <[email protected]>
Signed-off-by: Craig Perkins <[email protected]>
Signed-off-by: Craig Perkins <[email protected]>
Signed-off-by: Craig Perkins <[email protected]>
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR introduces a SPI from the Security Plugin that others plugins can extend to get resource access control provided by the security plugin.
It relies on this core PR to make extended plugins optional:
It also relies on this core PR to allow the security plugin to write integration tests with classpath extensible plugins:
Background:
In the default distribution of OpenSearch, there are many instances of plugins implementing custom resource access control because the security plugin does not provide a mechanism to secure resources created by plugins. For example, a simple search for
filter_by_backend_roles
on the documentation website shows a few plugins that implement custom resource access control.filter_by_backend_role
is a very simplistic access control mechanism that plugins use that restrict what resources are listed when an authenticated user is on a page is OpenSearch Dashboards that lists that specific type of resource.For instance, in ISM when a user navigates to the page that lists policies, the page will either list:
Any other policies would not be displayed and cannot be interacted with by the user.
In this simple model of resource access control, what a user can do with a resource is determined by the roles that user is mapped to and not determined by the user sharing their resource with another user. For instance, if a user is mapped to the
anomaly_detection_full_access
role, then that user will have full access to any detector shared with the user. The user sharing the detector has no mechanism to specify that the user that they are sharing the detector with only has read access to the detector that they have ownership over.One other shortfall of the current resource access control model is that plugins end up copying the user from the ThreadContext at the time that a resource is created and store the copy in the resource's metadata. Any changes to the user are not propagated.
SPI:
This PR lays the foundation for providing a consistent resource access control experience across plugins in the default distribution.
This particular PR provides an off ramp for the current simple resource access control prevalent across plugins and centralizes the access control to the security plugin.
Plugins can transition to using this SPI and maintain backward compatibility with the current resource access control model
filter_by_backend_role
.In 3.0.0, I would like to change the resource access control model to one where the owner of a resource can specify the level of access of a resource when sharing with other users on the platform.
For example, imagine a Searchable Photo Album Plugin. In this plugin, a user can create photo albums, upload photos to an album, add captions, tag images, and leave comments.
Number 2 is not possible in the current access control model. In the current access control model, if a user has
searchable_photo_album_full_access
role, then they will have full access over any album shared to them and the user sharing their album has no control over the level of access to the album that other users have.For Plugin Developers:
For plugin developers, add a dependency on the security plugin SPI and then create an implementation of
ResourceSharingExtension
which needs 4 (maybe 3 minus the ResourceParser) methods implemented:Within createComponents, check to see if security is installed (i.e.
assignResourceSharingService
is called) or else create an instance of theDefaultResourceSharingService
. With theDefaultResourceSharingService
, all users have access to any resource regardless of who creates the resource.This
ResourceSharingService
can then be used by plugin developers to determine whether the current user has access to a resource. The interface is defined like this:Testing:
Run tests using
./gradlew :opensearch-security-sample-extension:integTest -x test -x integrationTest -x spotbugsIntegrationTest -Dtests.opensearch.username=admin -Dtests.opensearch.password=admin -Duser=admin -Dpassword=admin -Dhttps=true -Dsecurity=true -Dtests.opensearch.secure=true -i